package com.ysl.fairy_could_class.service.impl;

import com.ysl.fairy_could_class.domain.User;
import com.ysl.fairy_could_class.mapper.UserMapper;
import com.ysl.fairy_could_class.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper mapper;
    @Override
    public List<User> selectAll() {
        return mapper.selectAll();
    }
    @Override
    public User selectById(int id) {
        return mapper.selectById(id);
    }
    @Override
    public int SaveUser(User user) {
        return mapper.SaveUser(user);
    }
    @Override
    public int UpdateUser(User user) {
        return mapper.UpdateUser(user);
    }
    @Override
    public int DeleteUser(int id) {
        return mapper.DeleteUser(id);
    }
    @Override
    public String checkUser(User user) {
        int res = mapper.checkUser(user);
        if (res == 1) {
            return "登录成功";
        } else {
            return "用户名或密码错误";
        }
    }
}

